home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d990.lha / Stocks / CalcCommission.rexx < prev    next >
OS/2 REXX Batch file  |  1994-04-05  |  2KB  |  80 lines

  1. /*
  2. **    Calculate Stock Commission for StockCross Brokerage Firm
  3. */
  4.  
  5. PARSE ARG type stockOrOption name quantity price
  6.  
  7. /*
  8. **    type = BUY or SELL
  9. **
  10. **    stockOrOption = STOCK or OPTION
  11. **
  12. **    quanitity = number of shares traded
  13. **
  14. **    price = price of stock or option
  15. */
  16.  
  17. /*
  18. **    StockCross does not treat BUY or SELL any differently
  19. **    so nothing is done with type.
  20. */
  21.  
  22.     select;
  23.         when stockOrOption = "STOCK"
  24.         then do
  25.             commission = 25 + 0.085 * quantity
  26.         end
  27.  
  28.         when stockOrOption = "OPTION"
  29.         then do
  30.             select;
  31.                 when (price < 2.000)
  32.                 then do
  33.                     if quantity < 1100
  34.                     then commission = quantity * 0.030
  35.                     else
  36.                     if (quantity < 3100)
  37.                     then commission = quantity * 0.020
  38.                     else commission = quantity * 0.015
  39.                 end
  40.  
  41.                 when (price < 4.000)
  42.                 then do
  43.                     if (quantity < 1100)
  44.                     then commission = quantity * 0.045
  45.                     else
  46.                     if (quantity < 3100)
  47.                     then commission = quantity * 0.025
  48.                     else commission = quantity * 0.020
  49.                 end
  50.  
  51.                 when (price < 8.000)
  52.                 then do
  53.                     if (quantity < 1100)
  54.                     then commission = quantity * 0.065
  55.                     else
  56.                     if (quantity < 3100)
  57.                     then commission = quantity * 0.035
  58.                     else commission = quantity * 0.030
  59.                 end
  60.  
  61.                 otherwise
  62.                     if (quantity < 1100)
  63.                     then commission = quantity * 0.080
  64.                     else
  65.                     if (quantity < 3100)
  66.                     then commission = quantity * 0.060
  67.                     else commission = quantity * 0.050
  68.             end
  69.  
  70.             if (commission < 20.000)
  71.             then commission = 20.000
  72.         end
  73.  
  74.         otherwise
  75.             say "Unknown stockOrOption Type"
  76.             commission = 0
  77.     end
  78.  
  79. exit trunc( commission + 0.0005, 3 )
  80.